package com.yejiarong.influxdb.common.config;

import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author YeJR
 */
@Configuration
public class InfluxdbConfig {

    @Value(value = "${influxdb.host}")
    private String host;

    @Value(value = "${influxdb.token}")
    private String token;

    @Bean
    public InfluxDBClient influxDBClient() {
        return InfluxDBClientFactory.create(host, token.toCharArray());
    }
}
